package com.hqx.gulimall.ware.config;

import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.transaction.annotation.EnableTransactionManagement;

@Configuration
@ComponentScan("com.hqx.gulimall.ware")
@EnableTransactionManagement //开启事务管理
public class MybatisConfig {

    @Bean
    public PaginationInterceptor paginationInterceptor(){
        PaginationInterceptor paginationInterceptor = new PaginationInterceptor();
        paginationInterceptor.setOverflow(true); //请求页超过最大页时，true表示回到第一页，false表示继续请求，默认false
      paginationInterceptor.setLimit(100); //设置单页最大数量，默认500，-1不受限制
        return paginationInterceptor;
    }
}
